{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "z7OH55JAyBtP",
        "outputId": "42155eeb-8921-433c-fe3b-d3d1a9c4ef87"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\u001b[?25l   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/116.9 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K   \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m\u001b[90m━\u001b[0m \u001b[32m112.6/116.9 kB\u001b[0m \u001b[31m12.4 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m116.9/116.9 kB\u001b[0m \u001b[31m2.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h\u001b[?25l   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/129.3 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.3/129.3 kB\u001b[0m \u001b[31m9.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h\u001b[?25l   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/76.1 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.1/76.1 kB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.4/44.4 kB\u001b[0m \u001b[31m3.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m72.0/72.0 kB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m62.5/62.5 kB\u001b[0m \u001b[31m4.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h"
          ]
        }
      ],
      "source": [
        "!pip install -Uq openai-agents"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import nest_asyncio\n",
        "nest_asyncio.apply()"
      ],
      "metadata": {
        "id": "b_oiXjYxyG7N"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from google.colab import userdata\n",
        "import os\n",
        "\n",
        "os.environ['OPENAI_API_KEY'] = userdata.get('OPENAI_API_KEY')"
      ],
      "metadata": {
        "id": "StzQUDSUyJE5"
      },
      "execution_count": 3,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Setup vector store on OPENAI dashboard\n",
        "- create `vector store` in openai panel.\n",
        "- copy `vector store name`\n",
        "  - upload pdf file here"
      ],
      "metadata": {
        "id": "gXWTut66yXoa"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from agents import Agent, FileSearchTool, Runner, WebSearchTool\n",
        "\n",
        "agent = Agent(\n",
        "    name=\"Assistant\",\n",
        "    tools=[\n",
        "        WebSearchTool(),\n",
        "        FileSearchTool(\n",
        "            max_num_results=3,\n",
        "            # vector_store_ids=[\"VECTOR_STORE_ID\"],\n",
        "            vector_store_ids=[\"vs_6813268d82a081919782a0990f3a68f9\"],\n",
        "\n",
        "        ),\n",
        "    ],\n",
        ")\n",
        "\n",
        "\n",
        "result =  Runner.run_sync(agent, \"Show Muhammad Qasim current organization and job title\")\n",
        "print(result.final_output)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "EfqeB7EmyMcN",
        "outputId": "2ed317d4-23cb-480f-a95e-8f3d877efe71"
      },
      "execution_count": 6,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Muhammad Qasim currently holds several roles:\n",
            "\n",
            "1. **Honorary Chief Generative AI Officer (CGAIO)** for the Governor Sindh Initiative for GenAI, Web3, and Metaverse in Sindh, Pakistan.\n",
            "2. **Artificial Intelligence Teacher** at Saylani Mass Training in Karachi.\n",
            "3. **Chief Data Scientist** at Revolution Cancer PLLC and CancerLight LLC in New York, United States.\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# check internet serch tool"
      ],
      "metadata": {
        "id": "g4JFNl0q1Clw"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "result =  Runner.run_sync(agent, \"Current Pakistan India News\")\n",
        "print(result.final_output)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "eVyCHHBa0jB8",
        "outputId": "d3728507-d3bc-4f28-87be-0234a5a0a156"
      },
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Tensions between India and Pakistan have escalated following a deadly terrorist attack in Pahalgam, Kashmir, on April 22, 2025, which resulted in the deaths of 26 Hindu tourists. India has accused Pakistan of supporting the attackers, an allegation that Islamabad denies. In response, India has expelled Pakistani diplomats, closed its airspace to Pakistani aircraft, and suspended the Indus Waters Treaty—a significant agreement governing water sharing between the two nations. Military skirmishes have been reported along the Line of Control, with both sides accusing each other of initiating fire. Pakistan claims to have \"credible intelligence\" suggesting that India is planning a military strike within days and has vowed to respond forcefully if provoked. The United States has urged both countries to de-escalate tensions, with Secretary of State Marco Rubio engaging in calls with Indian and Pakistani leaders to reduce hostilities. International actors, including the United Nations and China, have also called for calm to prevent further escalation. ([apnews.com](https://apnews.com/article/aed836213c7000f39cf89dca9be7ff75?utm_source=openai), [reuters.com](https://www.reuters.com/world/india/india-wants-kashmir-attackers-brought-justice-foreign-minister-tells-rubio-2025-05-01/?utm_source=openai), [ft.com](https://www.ft.com/content/3a872cd2-466e-4fc3-a312-87609c22724f?utm_source=openai), [apnews.com](https://apnews.com/article/a16c6fc5cf190f0ce0759ad4370a29cc?utm_source=openai))\n",
            "\n",
            "\n",
            "## Escalating Tensions Between India and Pakistan:\n",
            "- [Rubio calls India and Pakistan in effort to defuse crisis over Kashmir attack](https://apnews.com/article/aed836213c7000f39cf89dca9be7ff75?utm_source=openai)\n",
            "- [India wants Kashmir attackers brought to justice, foreign minister tells Rubio](https://www.reuters.com/world/india/india-wants-kashmir-attackers-brought-justice-foreign-minister-tells-rubio-2025-05-01/?utm_source=openai)\n",
            "- [US urges India and Pakistan to de-escalate tensions](https://www.ft.com/content/3a872cd2-466e-4fc3-a312-87609c22724f?utm_source=openai) \n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "KoZYaYVoDblx"
      },
      "execution_count": 19,
      "outputs": []
    }
  ]
}